'''
Created on Jan 22, 2010

@author: maasen
'''
import urllib
from xml.dom import minidom

#Gets the XML document for a given Clinical Trial ID
def get_CT(CT_ID):
    url = "http://www.clinicaltrials.gov/show/" + CT_ID + "?displayxml=true"

    print 'Getting: ' + CT_ID
    
    xmldoc = get_remote_xmldoc(url) #minidom.parse(sock).documentElement       
        
    print 'Got XML Doc'
    return xmldoc
#Gets a xml document at the specified URL
def get_remote_xmldoc(url):
    sock = urllib.urlopen(url)
    xmldoc = minidom.parse(sock).documentElement       
    sock.close()
    return xmldoc
